﻿/*
 * Copyright (c) Seagull Consulting, Inc. All rights reserved. See License.txt in the project root for license information.
 */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using SeagullConsulting.MvcAjaxControls.Data.Models;

namespace SeagullConsulting.MvcAjaxControls.Data.Repository
{
    public class StateRepository
    {
        IList<State> states;

        public StateRepository()
        {
            states = new List<State>() {
                new State() { Id = 1, CountryId = 1, Name = "FL"},
                new State() { Id = 2, CountryId = 1, Name = "GA"},
                new State() { Id = 3, CountryId = 2, Name = "ON"},
                new State() { Id = 4, CountryId = 2, Name = "QC"},
            };
        }

        public IQueryable<State> List()
        {
            return states.OrderBy(s => s.Name).AsQueryable();
        }

        public IQueryable<State> List(int countryId)
        {
            return states.Where(s => s.CountryId == countryId).OrderBy(s => s.Name).AsQueryable();
        }

    }
}